<?php

use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserDeviceInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_device_infos', function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->comment = '用户设备信息表';
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('用户id')->index();
            $table->unsignedInteger('loan_request_id')->comment('授信id')->index();
            $table->unsignedInteger('ip')->comment('请求ip');
            $table->string('device_type')->comment('设备类型');
            $table->string('device')->comment('设备型号');
            $table->string('device_os')->comment('设备系统');
            $table->string('device_mac')->comment('设备mac号');
            $table->string('device_imei')->nullable()->comment('设备IMEI');
            $table->string('device_uuid')->nullable()->comment('设备UUID');
            $table->string('device_app')->comment('APP版本号');
            $table->string('gps')->comment('请求GPS （经纬度）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_device_infos');
    }
}
